<?php
/**********************
* Starting setting up *
**********************/

//$start = microtime(1);

//header('Not Modified', true, 304);
require("compat.php");

//Output & encoding
//define("_DEFAULT_ENCODING", mb_internal_encoding());

//ob_start with empty string as a param consumes less memory o_0
//mb_http_output("UTF-8");
//mb_internal_encoding("UTF-8");

//ob_start("mb_output_handler");

//header("cache-control: no-cache, must-revalidate"); // http/1.1
//header("pragma: no-cache"); // http/1.1
//header("last-modified: ".gmdate("d, d m y h:i:s")."gmt");

//System defines
define("_SYSTEM_DIR", $_SERVER['DOCUMENT_ROOT']."../"._SYSTEM_NAME."/");

define("_CLASSES_DIR", _SYSTEM_DIR."classes/");
define("_FUNCTIONS_DIR", _SYSTEM_DIR."functions/");
define("_SERVICES_DIR", _SYSTEM_DIR."services/");
define("_STRUCTURE_DIR", _SYSTEM_DIR."structure/");
define("_SCRIPTS_DIR", _SYSTEM_DIR."scripts/");

//Project defines
define("_PROJECT_DIR", $_SERVER['DOCUMENT_ROOT']."../"._PROJECT_NAME."/");

define("_COMPONENTS_DIR", _PROJECT_DIR."components/");
define("_CONFIGS_DIR", _PROJECT_DIR."configs/");
define("_DESIGN_DIR", _PROJECT_DIR."design/");
define("_IMAGES_DIR", _PROJECT_DIR."img/");
define("_PROJECT_SCRIPTS_DIR", _PROJECT_DIR."scripts/");
define("_PROJECT_CLASSES_DIR", _PROJECT_DIR."classes/");
define("_PROJECT_FUNCTIONS_DIR", _PROJECT_DIR."functions/");
define("_PROJECT_STRUCTURE_DIR", _PROJECT_DIR."structure/");
define("_TEMP_DIR", _PROJECT_DIR."temp/");


//if (!defined("PATH_SEPARATOR")) define("PATH_SEPARATOR", getenv("COMSPEC")? ";" : ":");
//ini_set("include_path", ini_get("include_path").PATH_SEPARATOR._SERVICES_DIR);

//Including core functions
$dir = scandir(_FUNCTIONS_DIR."core/");
foreach ($dir as $item)
{
	if (preg_match("~^.+\\.function\\.php$~i", $item))
	{
		require_once(_FUNCTIONS_DIR."core/".$item);
	}
}

//Initializing
core()->Start();
//print round(microtime(1) - $start, 3);